)
{
size_t i;
Ec_group *ret = NULL;
if (Nid
3) int Ec_key_generate_keyThe ECC public private key is generated according to the key parameter.
int Ec_key_generate_key (Ec_key *eckey)
{
if (Eckey = = NULL | | eckey->group = NULL) {
Ecerr (ec_f_ec_ Key_generate_key, err_r_passed_null_parameter);
return 0;
}
if (
generate an empty group, and then P,, B and other parameters to fill the group, and then generate points on the curve based on this group.
if (!EC_GROUP_set_curve_GFp(group, p, a, b,ctx)){ gotoerr_process;} P = EC_POINT_new(group);Q = EC_POINT_new(group);R = EC_POINT_new(group);if (!P || !Q || !R){ gotoerr_process;}This section determines all information about the group and generates three points on the curve based on the group (the point must be on the curve, which
. Call evp_verifyupdate. This is done by calling the update callback function initialized in step 1;7. Call evp_verifyfinal to complete the final step. In evp_verifyfinal, call evp_digestfinal_ex to complete the digest calculation, and then call evp_md's verify callback function:Evp_digestfinal_ex ( tmp_ctx, (M [0]), m_len );I = CTX-> digest-> verify (CTX-> digest-> type, M, m_len, sigbuf, siglen, pkey-> pkey. PTR );8. For ECC, the callback function verify is ecdsa_verify. This function finall
initialization;7. Call Evp_verifyfinal to complete the final steps. In Evp_verifyfinal, first call EVP_DIGESTFINAL_EX to complete the calculation of the digest, and then call EVP_MD's Verify callback function:EVP_DIGESTFINAL_EX (tmp_ctx, (m[0]), m_len);i = ctx->digest->verify (Ctx->digest->type,m,m_len, sigbuf,siglen,pkey->pkey.ptr);8. For ECC, the callback function verify is ecdsa_verify, which eventually calls Ecdsa_do_verify:int ecdsa_do_verify (const unsigned char *dgst, int dgst_len,Const
follows:
1, the receiving party after receiving the message (m) and the signature value (R,s), the following operation
2, Calculation: Sg+h (m) p= (x1,y1), r1≡x1 mod P.
3. Verification equation: R1≡r mod p.
4, if the equation is established, accept the signature, otherwise the signature is invalid.
The following is a section of the OpenSSL source API (D:\OPENSSL-1.0.1E\CRYPTO\ECDSA) [CPP] view plain copy print? int ecdsa_sign (int type, const unsigned char *dgst, int dlen, unsigned char *sig,
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.